using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class FaceBookPluginSetCtrl : PluginSettingBaseCtrl
	{
		internal Grid LayoutRoot;
		internal ClickableLayout pluginItem;
		internal TextBlock lookFriends;
		internal ClickableLayout pluginItem2;
		internal TextBlock textButton;
		internal TextBlock textAcount;
		private bool _contentLoaded;
		public FaceBookPluginSetCtrl()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.onControlLoaded));
		}
		private void onControlLoaded(object sender, RoutedEventArgs e)
		{
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount == null)
			{
				return;
			}
			string text;
			if (!string.IsNullOrEmpty(curAccount.FBUserName))
			{
				text = curAccount.FBUserName;
			}
			else
			{
				text = strings.Set_Account_NotBind;
			}
			this.textAcount.set_Text(text);
		}
		private void pluginItem_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage == null)
			{
				return;
			}
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount == null)
			{
				return;
			}
			if (curAccount.FaceBookFlag <= 0u)
			{
				FaceBookBind.ShowBindPage(basePage, false);
				return;
			}
			FaceBookFriends.ShowFaceBookFriendsPage(basePage, curAccount.FBToken, false);
		}
		private void pluginItem2_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage == null)
			{
				return;
			}
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount == null)
			{
				return;
			}
			if (curAccount.FaceBookFlag <= 0u)
			{
				FaceBookBind.ShowBindPage(basePage, false);
				return;
			}
			UnbindFaceBook.ShowUnbindFaceBookPage(basePage, curAccount.FBToken);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Facebook/UI/FaceBookPluginSetCtrl.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.pluginItem = (ClickableLayout)base.FindName("pluginItem");
			this.lookFriends = (TextBlock)base.FindName("lookFriends");
			this.pluginItem2 = (ClickableLayout)base.FindName("pluginItem2");
			this.textButton = (TextBlock)base.FindName("textButton");
			this.textAcount = (TextBlock)base.FindName("textAcount");
		}
	}
}
